﻿using System.Configuration;

namespace Nana.Web.Compressing
{
  [ConfigurationCollection(typeof(CompressionTesterElement))]
  public class CompressionTesterCollection
    : ConfigurationElementCollection
  {
    [ConfigurationProperty("alwaysIncludeTextCategory", DefaultValue = true)]
    public bool AlwaysIncludeTextCategory
    {
      get
      {
        return this.GetConfig(c => c.AlwaysIncludeTextCategory);
      }
      set
      {
        this.SetConfig(c => c.AlwaysIncludeTextCategory, value);
      }
    }

    public void Add(CompressionTesterElement element)
    {
      BaseAdd(element, true);
    }
    public void Clear()
    {
      BaseClear();
    }

    protected override ConfigurationElement CreateNewElement()
    {
      return new CompressionTesterElement();
    }
    protected override object GetElementKey(ConfigurationElement element)
    {
      return ((CompressionTesterElement)element).Name;
    }
    public int IndexOf(CompressionTesterElement element)
    {
      return BaseIndexOf(element);
    }

    public void Remove(string name)
    {
      BaseRemove(name);
    }
    public void Remove(CompressionTesterElement element)
    {
      BaseRemove(element.Name);
    }
    public void RemoveAt(int index)
    {
      BaseRemoveAt(index);
    }

  }
}
